// MyEdit.cpp : implementation file
//

#include "stdafx.h"
#include "TraceMessage.h"
#include "MyEdit.h"
#include "TraceMessageDlg.h"


// CMyEdit

IMPLEMENT_DYNAMIC(CMyEdit, CEdit)

CMyEdit::CMyEdit()
{

}

CMyEdit::~CMyEdit()
{
}


BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
	ON_WM_CHAR()
END_MESSAGE_MAP()



// CMyEdit message handlers




BOOL CMyEdit::PreTranslateMessage(MSG* pMsg)
{
	// TODO: Add your specialized code here and/or call the base class
	CTraceMessageDlg *pDlg = (CTraceMessageDlg *)AfxGetApp()->m_pMainWnd;
	CString str;
	BOOL ret;

	str.Format(_T("Enter MyEdit PreTranslateMessage:           msg=0x%08X, wParam=0x%08X, lParam=0x%08X, %s\n"), pMsg->message, pMsg->wParam, pMsg->lParam, pDlg->Message2String(pMsg->message));
	pDlg->TraceToFile(str);

	ret = CEdit::PreTranslateMessage(pMsg);

	str.Format(_T("Leave MyEdit PreTranslateMessage:           msg=0x%08X, wParam=0x%08X, lParam=0x%08X, %s\n"), pMsg->message, pMsg->wParam, pMsg->lParam, pDlg->Message2String(pMsg->message));
	pDlg->TraceToFile(str);
	return ret;
}


LRESULT CMyEdit::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	// TODO: Add your specialized code here and/or call the base class
	CTraceMessageDlg *pDlg = (CTraceMessageDlg *)AfxGetApp()->m_pMainWnd;
	CString str;
	LRESULT ret;

	str.Format(_T("Enter MyEdit WindowProc:                    msg=0x%08X, wParam=0x%08X, lParam=0x%08X, %s\n"), message, wParam, lParam, pDlg->Message2String(message));
	pDlg->TraceToFile(str);

	ret = CEdit::WindowProc(message, wParam, lParam);

	str.Format(_T("Leave MyEdit WindowProc:                    msg=0x%08X, wParam=0x%08X, lParam=0x%08X, %s\n"), message, wParam, lParam, pDlg->Message2String(message));
	pDlg->TraceToFile(str);
	return ret;
}





void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// TODO: Add your message handler code here and/or call default
	CTraceMessageDlg *pDlg = (CTraceMessageDlg *)AfxGetApp()->m_pMainWnd;
	CString str;

	str.Format(_T("Enter MyEdit OnChar:                        nChar=0x%02X, nRepCnt=0x%02X, nFlags=0x%08X\n"), nChar, nRepCnt, nFlags);
	pDlg->TraceToFile(str);

	CEdit::OnChar(nChar, nRepCnt, nFlags);

	str.Format(_T("Leave MyEdit OnChar:                        nChar=0x%02X, nRepCnt=0x%02X, nFlags=0x%08X\n"), nChar, nRepCnt, nFlags);
	pDlg->TraceToFile(str);
}
